home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / Sample Code / Newton Sample Code 1.1 / Views / resize link next >
Encoding:
Text File  |  1993-10-08  |  3.9 KB  |  103 lines  |  [TEXT/GEOL]

  1. Item    1098893                         7-Oct-93        13:57PDT
  2.  
  3. From:   MSHARP                          Sharp, Maurice
  4.  
  5. To:     HERRICK1                        Herrick, Catherine
  6.  
  7. ------------------------------------------------------------------------------
  8.  
  9. Sub:    resize link
  10.  
  11. ©1993 Apple Computer Inc.
  12. Apple Preliminary-Confidential
  13.  
  14. Hi folks...
  15.  
  16. This is a friendly reminder that your applications should be screen-size
  17. indepenedent. We are looking into products that have industry standard screen
  18. sizes, such as VGA (640x480) and fractional VGA screens (320x240).
  19.  
  20. This means you should develop with smaller and larger screen sizes in mind.
  21. This is supported in the current version of Newton software.
  22.  
  23. There are 2 main ways to make sure you application works at different screen
  24. sizes.
  25.  
  26.     1. Develop and design based on the smallest standard screen (320x240)
  27.  
  28.     2. Develop and design fully dynamic resizeable apps
  29.  
  30. Option 2 may seem a bit scary and very difficult at first, but there is support
  31. in the system to help you do this:
  32.  
  33. GetAppParams()
  34.  
  35. This function call returns a frame describing the current device view bounds
  36. and the location of the buttons. The return frame looks like this:
  37.  
  38.         {appAreaTop: 0,
  39.          appAreaLeft: 0,
  40.          appAreaWidth: 240,
  41.          appAreaHeight: 320,
  42.          buttonBarPosition: 'bottom} // one of 'top, 'bottom, 'left, 'right
  43.  
  44. You can use this call to set the viewbounds of your base application view
  45. during at viewSetupFormScript time. The simplest way is to create a function
  46. that will resize your view for you and call it from you viewSetupFormScript.
  47. Here is one that will take up the entire screen (leaving space for a frame
  48. around the base view):
  49.  
  50. sizeBaseToDisplay
  51. func()
  52. func()
  53. begin
  54.     // assumes a 1 pixel frame and top left parent relative justification
  55.     local b := getAppParams();
  56.     self.viewbounds.top := b.appAreaTop + 2 ;
  57.     self.viewbounds.left := b.appAreaLeft + 2;
  58.     self.viewBounds.bottom := self.viewbounds.top + b.appAreaHeight - 4 ;
  59.     self.viewBounds.right := self.viewbounds.left + b.appAreaWidth - 4;
  60. end
  61.  
  62. You may also have the function give you a maximum size as well:
  63.  
  64. sizeBaseToDisplay
  65. func()
  66. begin
  67.     local b := getAppParams();
  68.     self.viewbounds.top := b.appAreaTop + 2 ;
  69.     self.viewbounds.left := b.appAreaLeft + 2;
  70.     // always be no higher than the MessagePad screen
  71.     self.viewBounds.bottom := MIN(self.viewbounds.top + b.appAreaHeight - 4,
  72.                                     336) ;
  73.     // always be no wider than the MessagePadScreen
  74.     self.viewBounds.right := MIN(self.viewbounds.left + b.appAreaWidth - 4,
  75.                                     340) ;
  76. end
  77.  
  78.  
  79. Once your base application view is sized correctly, you can use the viewJustify
  80. slot to make other parts of your application parent releative or sibling
  81. relative justified. Not all parts of your application need to be full or center
  82. justified, some parts will not be affected by a slightly smaller screen size.
  83.  
  84. Other parts of your application may need to be dynamically constructed (a view
  85. that has children representing soup entries, like the checkbook).
  86.  
  87. Your application base view should include a border. That way if your
  88. application is launched on screen that is larger than the maximum size of your
  89. application, the user will be able to see it.
  90.  
  91. WARNING 1: Do not use full justification in your base application view. The
  92. rootView may be larger than the visible area of the screen.
  93.  
  94. WARNING 2: Do not rely on upper left global coordinate of your application
  95. being fixed. On a larger screen it may be possible to move your base
  96. application around the screen. If you work with global coordinates in your
  97. application, make sure you check the current location of your base view (send a
  98. GlobalBox() message to your base view).
  99.  
  100. If you follow these simple design and develop guidelines, your application
  101. should work on future Newton products.
  102.  
  103.